<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>平移</title>
  <style>
    .father{
      width: 500px;
      height: 500px;
      margin: 100px;
      border: 1px solid black;
    }
    .son{
      width: 100px;
      height: 100px;
      background-color: red;
      transition: all 1s;
    }
/* 鼠标进入父类盒子，子改变位置 */
    .father:hover .son{
      transform: translate(200px,200px);
      transform: translate(50%,50%);
      transform: translate(-50%,50%);
      transform: translate(-50%);
      transform: translateX(50%);
      transform: translateY(50%);
    } 

  </style>
</head>
<body>
  <div class="father">
    <div class="son"></div>
  </div>
</body>
</html>